package ferp.poll;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * User: igorgok
 * Date: 15/05/2014 09:04
 */
public class Question
{
  public Question(Poll.Language language, int id, Option... options)
  {
    this(language.question(id), options);
  }

  public Question (String text, Option... options)
  {
    this.text = text;
    this.options = new ArrayList<Option>(Arrays.asList(options));
  }

  public String text() {return text;}
  public Option option(int index) {return options.get(index);}
  public List<Option> options() {return options;}

  public List<String> answers()
  {
    List<String> answers = new ArrayList<String>(options.size());

    for (Option o : options)
      answers.add(o.text());

    return answers;
  }

  private String text;
  private List<Option> options;
}
